#include<iostream>
#include<pthread.h>
#include<unistd.h>
#include<string>
using namespace std;
int g_val=100;
void show(const string &name)
{
	cout<<name<<"say#"<<"hello thread"<<endl;
}
void *pthreadroutine(void* args)
{
	while(true)
	{
		cout<<"new thread,pid:"<<getpid()<<endl;
		sleep(1);
		show("[new thread]");
	}

}
int main()
{
	pthread_t rid;
	pthread_create(&rid,nullptr,pthreadroutine,nullptr);
	while(true)
	{
		cout<<"main thread ,pid:"<<getpid()<<g_val<<",g_val"<<endl;
		sleep(1);
		show("[main thread]");
		g_val++;
	}

	return 0;
}
